<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Table</title>

    <!-- Styles -->
    <link href="assets/css/lib/font-awesome.min.css" rel="stylesheet">
    <link href="assets/css/lib/themify-icons.css" rel="stylesheet">
    <link href="assets/css/lib/menubar/sidebar.css" rel="stylesheet">
    <link href="assets/css/lib/bootstrap.min.css" rel="stylesheet">
    <link href="assets/css/lib/helper.css" rel="stylesheet">
    <link href="assets/css/style.css" rel="stylesheet">
</head>

<body>

<div class="sidebar sidebar-hide-to-small sidebar-shrink sidebar-gestures">
    <div class="nano">
        <div class="nano-content">
            <div class="logo"><a href="index.html">
                <!-- <img src="assets/images/logo.png" alt="" /> --><span>医疗管理系统</span></a></div>
            <ul>
                <li><a class="sidebar-sub-toggle"><i class="ti-layout-grid4-alt"></i> 医疗管理 <span
                        class="sidebar-collapse-icon ti-angle-down"></span></a>
                    <ul>
                        <li><a href="yl-index.html">科室管理</a></li>
                        <li><a href="yl-yisheng.html">医生管理</a></li>
                        <li><a href="yl-huanzhe.html">患者管理</a></li>
                        <li><a href="yl-chuangwei.html">床位查询</a></li>
                    </ul>
                </li>

            </ul>
        </div>
    </div>
</div>
<!-- /# sidebar -->


<div class="header">
    <div class="container-fluid">
        <div class="row">
            <div class="col-lg-12">
                <div class="float-left">
                    <div class="hamburger sidebar-toggle">
                        <span class="line"></span>
                        <span class="line"></span>
                        <span class="line"></span>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<div class="content-wrap">
    <div class="main">
        <div class="container-fluid">
            <div class="row">
                <div class="col-lg-8 p-r-0 title-margin-right">
                    <div class="page-header">
                        <div class="page-title">
                            <h1>Hello, <span>Welcome Here</span></h1>
                        </div>
                    </div>
                </div>
                <!-- /# column -->
                <div class="col-lg-4 p-l-0 title-margin-left">
                    <div class="page-header">
                        <div class="page-title">

                        </div>
                    </div>
                </div>
                <!-- /# column -->
            </div>
            <!-- /# row -->
            <section id="main-content">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="col-lg-12">
                            <div class="card">
                                <div class="card-title">
                                    <h4>添加患者</h4>
                                </div>
                                <div class="card-body">
                                    <div class="basic-form">
                                        <form>
                                            <div class="form-group">
                                                <input type="text" id="patientId" name="patientId" class="form-control input-default " placeholder="患者编号">
                                            </div>
                                            <div class="form-group">
                                                <input type="text" id="patientName" name="patientName" class="form-control input-flat" placeholder="患者姓名">
                                            </div>
                                            <div class="form-group">
                                                <input type="number" id="patientAge" name="patientAge" class="form-control input-rounded" placeholder="患者年龄">
                                            </div>
                                            <div class="form-group">
                                                <input type="text" id="patientGender" name="patientGender" class="form-control input-rounded" placeholder="患者性别">
                                            </div>
                                            <div class="form-group">
                                                <input type="text" id="patientXx" name="patientXx" class="form-control input-rounded" placeholder="患者血型">
                                            </div>
                                            <div class="card-title">
                                                <div id="top">
                                                    <label><input type="button" onclick="rtv()" value="返回" class="btn btn-primary"></label>
                                                    <label><input type="button" onclick="add()" value="添加患者" class="btn btn-primary"></label>
                                                </div>
                                            </div>
                                            <!-- /# row -->
                                            <script type="text/javascript" src="jquery-1.8.3.min.js"></script>
                                            <script type="text/javascript" src="1.js"></script>
                                            <script>
                                                function rtv(){
                                                    window.location.href = "yl-huanzhe.html";
                                                }
                                                function add() {
                                                    var patientId = $("#patientId").val();
                                                    var patientName = $("#patientName").val();
                                                    var patientAge = $("#patientAge").val();
                                                    var patientGender = $("#patientGender").val();
                                                    var patientXx = $("#patientXx").val();
                                                    if(patientId=="" || patientName=="" || patientAge=="" || patientGender=="" || patientXx==""){
                                                        alert("请填写完整信息");
                                                        return;
                                                    }
                                                    $.ajax({
                                                        url: "patient/addPatient",
                                                        type: "post",
                                                        async: false,
                                                        data: {
                                                            "patientId": patientId,
                                                            "patientName": patientName,
                                                            "patientAge": patientAge,
                                                            "patientGender": patientGender,
                                                            "patientXx": patientXx
                                                        },
                                                        cache: false,
                                                        dataType: "text",
                                                        "success": function (json) {
                                                            alert(json);
                                                            if (json == "添加成功") {
                                                                window.location.href = "yl-huanzhe.html";
                                                            }
                                                        }
                                                    })
                                                }
                                            </script>

                                        </form>
                                    </div>
                                </div>
                            </div>
                        </div>
                        </div>
                    </div>
                </div>

            </section>
        </div>
    </div>
</div>


<!-- jquery vendor -->
<script src="assets/js/lib/jquery.min.js"></script>
<script src="assets/js/lib/jquery.nanoscroller.min.js"></script>
<!-- nano scroller -->
<script src="assets/js/lib/menubar/sidebar.js"></script>
<script src="assets/js/lib/preloader/pace.min.js"></script>
<!-- sidebar -->

<!-- bootstrap -->
<script src="assets/js/lib/bootstrap.min.js"></script>
<script src="assets/js/scripts.js"></script>
<!-- scripit init-->


</body>

</html>
